<html>
<head>
	<title>Convert degrees</title>
</head>
<body>

	<form method="post" action="celsius_farenheit.php">
		<input name="degree"/>
									
		<select name="type">
			<option value="1">C->F</option>
			<option value="2">F->C</option>
		</select>
		<input type="submit" name="submit" value="Convert"/>
	</form>
	
<?php 

	//if(count($_POST)>0)
		
	if(isset($_POST['submit']))
	{
	
		$degree = $_POST["degree"];
		$option = $_POST["type"];
		
		if($option == 1)
		{
			$farenheit = (9/5)*$degree + 32;
			echo $farenheit; 
		} else if ($option == 2)

		{ 
			$celsius = (5/9)*($degree - 32);
			echo $celsius;		
		}

		
	
	
	}
?>

</body>
</html>

